import Es6Promise from 'es6-promise';
import 'babel-polyfill'
Es6Promise.polyfill();
require('es6-promise').polyfill()

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 加载 Vant 核心组件库
import Vant from 'vant'
import Bridge from '../src/js/js1'
// import $ from 'jquery'
// import Vconsole from 'vconsole'
// 引入swiper
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'
// 加载 Vant 全局样式
import 'vant/lib/index.css'
import 'amfe-flexible'
import { Toast } from 'vant';
// const vConsole = new Vconsole()
// Vue.use(vConsole)

import VueLazyLoad from 'vue-lazyload'; // 懒加载
import Video from 'video.js' // vieo 视频
import 'video.js/dist/video-js.css'

Vue.prototype.$video = Video
Vue.use(VueLazyLoad, {
  error: require('../src/assets/img/beg.png'), // 加载错误的图片
  loading: require('../src/assets/img/loading.gif') // 加载时的图片
});

Vue.config.productionTip = false
Vue.prototype.$bridge = Bridge

// 过滤器
Vue.filter('dateFormat', function (originVal) {
  const dt = new Date(originVal)

  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')

  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')

  return `${m}月${d}日`
})

Vue.use(Toast);
Vue.use(VueAwesomeSwiper);
// 注册使用 Vant 组件库
Vue.use(Vant)
new Vue({
  router,
  store,
  // $: "jquery",
  // jQuery: "jquery",
  render: h => h(App)
}).$mount('#app')
